//
//  BoundGuideWelcomeViewController.swift
//  EasePods
//
//  Created by 李然 on 2024/5/22.
//

import UIKit

class BoundGuideWelcomeViewController: ViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.navigation.bar.isHidden = true

        view.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        view.addSubview(completeBtn)
        completeBtn.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(-80-kSafeBottomMargin)
            make.size.equalTo(CGSize(width: kScreenWidth - 32, height: 57))
        }
        
        view.addSubview(tipLabel)
        tipLabel.snp.makeConstraints { make in
            make.leading.equalTo(16)
            make.trailing.equalTo(-16)
            make.bottom.equalTo(completeBtn.snp.top).offset(-82)
        }
        
        view.addSubview(welcomLabel)
        welcomLabel.snp.makeConstraints { make in
            make.leading.equalTo(16)
            make.trailing.equalTo(-16)
            make.bottom.equalTo(tipLabel.snp.top).offset(-14)
        }
        
        self.completeBtn.rx.tap.subscribe(onNext: { _ in
            let nav = NavigationController(rootViewController: HomeViewController())
            RootViewManager.default.transition(vc: nav)
        }).disposed(by: rx.disposeBag)
    }
    

    lazy var imageView: UIImageView = {
        let view = UIImageView()
        view.image = R.image.img_welcome()
        view.contentMode = .scaleAspectFill
        return view
    }()
    
    lazy var completeBtn: UIButton = {
        let btn = UIButton(type: .custom)
        btn.layer.cornerRadius = 6
        btn.backgroundColor = R.color.common_21_button_n()
        btn.setTitle(R.string.localizable.common_finished(), for: .normal)
        btn.titleLabel?.font = Fonts.systemFont(ofSize: 16,weight: .semibold)
        btn.setTitleColor(R.color.common_25_button_text(), for: .normal)
        return btn
    }()
    
    lazy var welcomLabel: UILabel = {
        let label = UILabel()
        label.textColor = R.color.common_8_text()
        label.font = Fonts.systemFont(ofSize: 48)
        label.numberOfLines = 0
        label.text = R.string.localizable.guide_welcome_title()
        return label
    }()
    
    lazy var tipLabel: UILabel = {
        let label = UILabel()
        label.textColor = R.color.common_26_text_second()
        label.font = Fonts.systemFont(ofSize: 22)
        label.numberOfLines = 0
        label.text = R.string.localizable.guide_welcome_tip(Bundle.main.displayName ?? "")
        return label
    }()

}
